home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1990 / 05 / testrsc.c < prev    next >
C/C++ Source or Header  |  1990-06-15  |  800b  |  40 lines

  1. /* testrsc.c    test loading, looking-up and printing resource strings.
  2.  */
  3.  
  4. #include <stdio.h>
  5. #include "testrsc.h"
  6. #include "resources.h"
  7.  
  8. void    fatal(char *str);
  9.  
  10. void
  11. main()
  12. {
  13.     StringResource    *res = LoadResources("strings.rsc");
  14.     StringResource    *current;
  15.  
  16.     if (res == NULL)
  17.         fatal("error loading strings.rsc");
  18.  
  19.     current = LookUpResource(res, TEST_STRING1);
  20.     printf("TEST_STRING1 = %s\n", GetResourceString(current));
  21.  
  22.     current = LookUpResource(res, TEST_STRING2);
  23.     printf("TEST_STRING2 = ");
  24.     printf(GetResourceString(current), 1);
  25.     printf("\n");
  26.  
  27.     current = LookUpResource(res, TEST_STRING3);
  28.     printf("TEST_STRING3 = ");
  29.     printf(GetResourceString(current), "string\n");
  30.  
  31.     exit(0);
  32. }
  33.  
  34. void
  35. fatal(char *str)
  36. {
  37.     fprintf(stderr, "fatal: %s\n", str);
  38.     exit(0);
  39. }
  40.